/*     */ package com.lmpop.trade.ti_emailtem;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_emailtemInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_emailtemInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  26 */     Ti_emailtem ti_emailtem = new Ti_emailtem();
/*  27 */     ti_emailtem.setTem_id(map.getString("tem_id"));
/*  28 */     ti_emailtem.setCust_id(map.getString("cust_id"));
/*  29 */     ti_emailtem.setTem_type(map.getString("tem_type"));
/*  30 */     ti_emailtem.setTem_name(map.getString("tem_name"));
/*  31 */     ti_emailtem.setContent(map.getString("content"));
/*  32 */     ti_emailtem.setIn_date(map.getString("in_date"));
/*  33 */     ti_emailtem.setUser_id(map.getString("user_id"));
/*     */ 
/*  35 */     String result_code = "0";
/*     */     try {
/*  37 */       insert(dbmMgr, ti_emailtem);
/*     */     } catch (ApplicationException e) {
/*  39 */       e.printStackTrace();
/*  40 */       result_code = "1";
/*     */     }
/*  42 */     map.setString("result_code", result_code);
/*  43 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_emailtem ti_emailtem)
/*     */     throws ApplicationException
/*     */   {
/*  52 */     dbmMgr.update("insertTi_emailtem", ti_emailtem);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  62 */     String pkid_string = map.getString("pkid");
/*  63 */     String result_code = "0";
/*     */     try {
/*  65 */       if (!pkid_string.equals("")) {
/*  66 */         String[] pkStr = pkid_string.split("\\|");
/*  67 */         for (int i = 0; i < pkStr.length; i++) {
/*  68 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  72 */       e.printStackTrace();
/*  73 */       result_code = "1";
/*     */     }
/*  75 */     map.setString("result_code", result_code);
/*  76 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  85 */     dbmMgr.update("deleteTi_emailtem", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  94 */     Ti_emailtem ti_emailtem = new Ti_emailtem();
/*  95 */     ti_emailtem.setTem_id(map.getString("tem_id"));
/*  96 */     ti_emailtem.setCust_id(map.getString("cust_id"));
/*  97 */     ti_emailtem.setTem_type(map.getString("tem_type"));
/*  98 */     ti_emailtem.setTem_name(map.getString("tem_name"));
/*  99 */     ti_emailtem.setContent(map.getString("content"));
/* 100 */     ti_emailtem.setIn_date(map.getString("in_date"));
/* 101 */     ti_emailtem.setUser_id(map.getString("user_id"));
/*     */ 
/* 103 */     String result_code = "0";
/*     */     try {
/* 105 */       update(dbmMgr, ti_emailtem);
/*     */     } catch (ApplicationException e) {
/* 107 */       e.printStackTrace();
/* 108 */       result_code = "1";
/*     */     }
/* 110 */     map.setString("result_code", result_code);
/* 111 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_emailtem ti_emailtem)
/*     */     throws ApplicationException
/*     */   {
/* 120 */     dbmMgr.update("updateTi_emailtem", ti_emailtem);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 133 */     Map ti_emailtem = (Hashtable)obj;
/* 134 */     if (start == 0)
/* 135 */       start = 0;
/*     */     else {
/* 137 */       start = (start - 1) * limit;
/*     */     }
/* 139 */     ti_emailtem.put("start", Integer.valueOf(start));
/* 140 */     ti_emailtem.put("limit", Integer.valueOf(limit));
/*     */ 
/* 142 */     return this.queryList.getList("selTi_emailtemList", ti_emailtem);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 154 */     Map ti_emailtem = (Hashtable)obj;
/*     */ 
/* 156 */     List list = this.queryList.getList("selTi_emailtemSum", ti_emailtem);
/* 157 */     int count = 0;
/* 158 */     if ((list != null) && (list.size() > 0)) {
/* 159 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 160 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 161 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 164 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 174 */     return this.queryList.getList("getTi_emailtemByPk", pk);
/*     */   }
/*     */ 
/*     */   public String getSelectByPara(String cust_id, String emailItemID)
/*     */   {
/* 185 */     Map params = new Hashtable();
/* 186 */     params.put("cust_id", cust_id);
/* 187 */     String emailItemSelect = "";
/* 188 */     List levelList = this.queryList.getList("getTi_emailtemByCustID", params);
/*     */ 
/* 191 */     if (levelList != null) {
/* 192 */       for (int i = 0; i < levelList.size(); i++) {
/* 193 */         String tem_id = ""; String tem_name = "";
/* 194 */         Hashtable advMap = (Hashtable)levelList.get(i);
/* 195 */         if (advMap.get("tem_id") != null) {
/* 196 */           tem_id = advMap.get("tem_id").toString();
/*     */         }
/* 198 */         if (advMap.get("tem_name") != null) {
/* 199 */           tem_name = advMap.get("tem_name").toString();
/*     */         }
/* 201 */         if (tem_id.equals(emailItemID))
/* 202 */           emailItemSelect = emailItemSelect + "<option value=" + tem_id + " selected >" + tem_name + "</option>";
/*     */         else {
/* 204 */           emailItemSelect = emailItemSelect + "<option value=" + tem_id + ">" + tem_name + "</option>";
/*     */         }
/*     */       }
/*     */     }
/* 208 */     return emailItemSelect;
/*     */   }
/*     */ 
/*     */   public String getSelectTemConetenByID(Map map)
/*     */   {
/* 221 */     Map params = new Hashtable();
/* 222 */     String emailItemSelect = "";
/* 223 */     List levelList = this.queryList.getList("getTi_emailtemContentByID", map);
/*     */ 
/* 226 */     if ((levelList != null) && (levelList.size() > 0)) {
/* 227 */       Hashtable advMap = (Hashtable)levelList.get(0);
/* 228 */       if (advMap.get("content") != null) {
/* 229 */         emailItemSelect = advMap.get("content").toString();
/*     */       }
/*     */     }
/* 232 */     return emailItemSelect;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_emailtem.Ti_emailtemInfo
 * JD-Core Version:    0.6.0
 */